package simple.enums;

public enum NSDirection {
	NORTH,
	SOUTH;
	
	public static NSDirection parseString(String direction) throws IllegalArgumentException {
		String d = direction.trim();
		if(d.equalsIgnoreCase("n") || d.equals("north")){
			return NSDirection.NORTH;
		}
		else if(d.equalsIgnoreCase("s") || d.equals("south")){
			return NSDirection.SOUTH;
		}
		else{
			throw new IllegalArgumentException("Valid arguments are: {n, north, s, south}.");
		}
	}
}
